*open log file to document full analysis code and output for JAERE Dataverse 
*	entry. 
global resultsfolder "C:\Users\guignetdb\Documents\Research_TEMP\RCRA_analysis\results\results2023_05"
log using "$resultsfolder\Full_Analysis_Log_2023_05_26", replace


*RCRA Nationwide Hedonic Study
*Master Dataprep Do-File
*Created: 5/20/2020
*Created by: Dennis Guignet
*Last Revised: 5/22/2023
*Last Revised by: Dennis Guignet

********************************************************************************

*This is master do-file that calls in various other do-files corresponding to 
*	different components of the analysis. 

********************************************************************************

*Set global directory folders

*Folder with analysis do-files
*global dofile_folder "G:\My Drive\Research\RCRA_benefits\analysis"
global dofile_folder "C:\Users\guignetdb\Documents\Research_TEMP\RCRA_analysis"
	*Note: Sometimes saved files on computer directly, rather than a network 
	*	drive, to speed up processing.
	
*Folder with final transaction data
global salesfolder "D:\RCRA_benefits2\FinalSalesData_2022_02"

*Folder with RCRA and Corrective Action data
*global RCRAfolder "G:\My Drive\Research\RCRA_benefits\data\RCRA_data"
global RCRAfolder "C:\Users\guignetdb\Documents\Research_TEMP\RCRA_analysis\RCRA_data"

*Folder for results output
*global resultsfolder "G:\My Drive\Research\RCRA_benefits\analysis\results\results2022_11"
global resultsfolder "C:\Users\guignetdb\Documents\Research_TEMP\RCRA_analysis\results\results2023_05"
 
*Folder for saving model coefficient estimates
global raw_resultsfolder "D:\RCRA_benefits2\model_estimates2023_05"



********************************************************************************

*Master do-file next calls in and runs separate do-file for each step 
*	of the analysis.

*STEP 1: Descriptive Stats of RCRA sites
cd "$dofile_folder"
do analysis_RCRABenefits_Step1_TSDSiteDescStats.do

*STEP 2: Sales distance gradient graphs to determine treatment and control groups. 
cd "$dofile_folder"
do analysis_RCRABenefits_Step2_DistGradients.do

*STEP 3: Coarsened Exact Matching and sample balance statistics
cd "$dofile_folder"
do analysis_RCRABenefits_Step3_CEMRoutine.do

*STEP 4: Main hedonic analysis and DID and Triple Differences treatment estimates  
cd "$dofile_folder"
do analysis_RCRABenefits_Step4_RegAnalysis.do

*STEP 5: Descriptive stats of housing sales dataset, and comparison of covariates across
*	different groups.
cd "$dofile_folder"
do analysis_RCRABenefits_Step5_SalesDescStats.do

*STEP 6: Parallel trends graphs
cd "$dofile_folder"
do analysis_RCRABenefits_Step6_ParallelTrendsGraphs.do

*STEP 7: Total capitalization and welfare effects.
cd "$dofile_folder" 
do analysis_RCRABenefits_Step7_ExtrapExcercise.do
		

*END

*Close log file
log close